<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>left</title>
    <base target="body"/>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <style type="text/css">
        * {
            font-size: 10pt;
            text-align: center;
        }

        #include div, #All {
            background: #87CEFA;
            margin: 3px;
            padding: 3px;
        }

        a {
            text-decoration: none;
        }
    </style>
    <script src="/jquery-3.3.1.js"></script>
    <script>
        $(document).ready(function () {
            $.get(
                '/category',
                null,
                function (categorys) {
                    console.log(categorys);
                    var div = "";
                    for (var i = 0; i < categorys.length; i++) {
                        div = div + '<div><a href="/book?cid=' + categorys[i].cid + '">' + categorys[i].cname + '分类</a></div>';
                    }
                    $("#include").html(div)
                },
                'json'
            );
        });
    </script>
</head>

<body>
<div id="All">
    <a href="<c:url value='/book?cid=all'/>">全部分类</a>
</div>

<div id="include">
    <%--<div>--%>
    <%--<a href="<c:url value='/jsps/book/list.jsp'/>">JavaSE分类</a>--%>
    <%--</div>--%>
    <%--<div>--%>
    <%--<a href="<c:url value='/jsps/book/list.jsp'/>">JavaEE分类</a>--%>
    <%--</div>--%>
    <%--<div>--%>
    <%--<a href="<c:url value='/jsps/book/list.jsp'/>">Javascript分类</a>--%>
    <%--</div>--%>
</div>
</body>
</html>
